import request from "@/utils/request";
import type {
  getTrademarkApiresponse,
  getTrademarkItem,
  getAllTrademarkList
} from "./model/trademarkModel";

enum Api {
  TradeMarklistApiUrl = "/admin/product/baseTrademark",
  getAllTrademarkListUrl = "/admin/product/baseTrademark/getTrademarkList",
  saveTrademarkUrl = "/admin/product/baseTrademark/save",
  updateTrademarkUrl = "/admin/product/baseTrademark/update",
  removeTrademarkUrl = "/admin/product/baseTrademark/remove",
}

/**
 * 获取分页列表
 * @param page 当前页码
 * @param limit
 * @returns
 */

export const getTradeMarklistApi = (page: number, limit: number) => {
  return request.get<any, getTrademarkApiresponse>(
    `${Api.TradeMarklistApiUrl}/${page}/${limit}`
  );
};

/**
 * 获取品牌列表数据
 * @returns getAllTrademarkList
 */
export const getAllTrademarkListApi=()=>{
  return request.get<any,getAllTrademarkList>(Api.getAllTrademarkListUrl)
}
export const saveTrademarkApi = (tmName: string, logoUrl: string) => {
  return request.post<any, null>(Api.saveTrademarkUrl, {
    tmName,
    logoUrl,
  });
};
export const updateTrademarkApi = (updateData: getTrademarkItem) => {
  return request.put<any, null>(Api.updateTrademarkUrl, updateData);
};
export const removeTrademarkApi = (id: number) => {
  return request.delete<any, null>(Api.removeTrademarkUrl + `/${id}`);
};
